<template>
  <div>
    <a-table
      rowKey="id"
      class="wearing-table"
      :columns="callLogColumns"
      :dataSource="dataSource"
      @change="handleTableChange"
    >
      <template slot="action" slot-scope="records">
        <span class="operation deatil-color" @click="handleChange(records)">更换</span>
      </template>
    </a-table>
  </div>
</template>

<script>
import { JeecgListMixinNew } from '@/mixins/JeecgListMixinNew'

export default {
  mixins: [JeecgListMixinNew],
  data() {
    return {
      url: {
        list: '/wb/device/deviceCallPage',
      },
      callLogColumns: [
        {
          title: '序号',
          align: 'center',
          width: 100,
          customRender: function (t, r, index) {
            return parseInt(index) + 1
          },
        },
        {
          title: '拨号时间',
          align: 'center',
          dataIndex: 'timeBeginStr',
          ellipsis: true,
        },
        {
          title: '通话建立时间',
          align: 'center',
          dataIndex: 'establishedTime',
          ellipsis: true,
        },
        {
          title: '通话时长',
          align: 'center',
          dataIndex: 'callDuration',
          ellipsis: true,
          customRender: (text) => {
            return text ? text + '秒' : '--'
          },
        },
        {
          title: '通话号码',
          align: 'center',
          dataIndex: 'contactNumber',
          ellipsis: true,
        },
        {
          title: '呼叫类型',
          align: 'center',
          dataIndex: 'contactType',
          ellipsis: true,
          customRender: (text) => {
            return text === '1' ? '呼出' : '呼入'
          },
        },
        {
          title: '呼叫状态',
          align: 'center',
          dataIndex: 'status',
          ellipsis: true,
          customRender: (text) => {
            return text === '1' ? '己接通' : '未接通'
          },
        },
      ],
      times: {},
      disableMixinCreated: false,
    }
  },
  method: {
    handleChange() {},
  },
  mounted() {
    this.extendParams = {
      imei: this.$route.query.imei,
    }
    this.loadData(1)
  },
}
</script>
